package com.geek.bulk.util;

import java.util.Objects;


public interface ClassUtils {

    static boolean isDerived(Class<?> targetType, Class<?>... superTypes) {
        if (superTypes == null || superTypes.length == 0 || targetType == null) {
            return false;
        }
        for (Class<?> superType : superTypes) {
            if (Objects.equals(superType, targetType) || superType.isAssignableFrom(targetType)) {
                return true;
            }
        }
        return false;
    }


    static Class<?>[] getTypes(Object... args) {
        Class[] types = new Class[args.length];
        for (int i = 0; i < args.length; i++) {
            types[i] = args[i].getClass();
        }
        return types;
    }

}
